use std::env;

use bb8::Pool;
use bb8_redis::RedisConnectionManager;

// Get a Redis connection pool
pub async fn get_redis_pool() -> Pool<RedisConnectionManager> {
    let redis_url: String = env::var("REDIS_URL").expect("Not configured in .env");
    let manager = RedisConnectionManager::new(redis_url).expect("Failed to connect to Redis");
    let pool = bb8::Pool::builder().build(manager).await.expect("Failed to create pool");
    pool
}